<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreatePurchasesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('purchases', function (Blueprint $table) {
            $table->bigIncrements('id');
            $table->string('number')->index()->nullable()->comment('采购单号');
            $table->string('description', '255')->nullable()->comment('描述');
            $table->string('handler', '50')->index()->nullable()->comment('经手人');
            $table->integer('time')->index()->default(0)->comment('采购时间戳');
            $table->integer('total_price')->index()->default(0)->comment('合计费用:单位分');
            $table->integer('other_price')->index()->default(0)->comment('其他费用:单位分');
            $table->integer('price')->index()->default(0)->comment('实际支付费用:单位分');
            $table->integer('pay_type')->index()->default(1)->comment('支付方式:1.现金、2.银行卡、3.微信、4.支付宝、5.赊账');
            $table->integer('status')->index()->default(1)->comment('状态：1.申请，2.通过、3.拒绝');
            $table->timestamps();
            $table->softDeletes();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('purchases');
    }
}
